package com.liwei.lwmail.seckill.scheduled;

import com.liwei.lwmail.seckill.service.SeckillService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

/**
 * 秒杀商品定时上架:每天凌晨三点，上架最近三天需要秒杀的商品
 * 当天：00:00:00 - 23:59:59
 * 明天：00:00:00 - 23:59:59
 * 后天：00:00:00 - 23:59:59
 */
@Service
public class SeckillSkuScheduled {

    @Autowired
    private SeckillService service;

    /**
     * 上架最近三天需要秒杀的商品
     */
    @Scheduled(cron = "0 0 3 * * ?")
    public void uploadLatest3DaysSku(){
        //1、重复上架无需处理
        service.uploadLatest3DaysSku();
    }

}
